package com.digitalart.site.section.subsectiontype.subsectionnav {
	import flash.events.Event;
	import flash.display.Sprite;

	/**
	 * @author johan.chaves
	 */
	public class NavView extends Sprite {
		
		public static const NAV_VIEW_READY : String = "navviewready";
		
		public static const ITEM_SPACE : Number = 0;
		
		private var _items : Array;
		
		public function NavView() {
			items = new Array();
		}
		
		public function init() : void {
			locateItems();			
		}
		
		private function locateItems() : void {
			
			var lastY : Number = 0;
			for each(var item : NavItem in items) {				
				item.y = lastY + ITEM_SPACE;
				lastY = item.y + item.height;
				addChild(item);
			}
			dispatchEvent(new Event(NavView.NAV_VIEW_READY));
		}
		
		public function setItemsUnselected() : void{
			for each(var item : NavItem in items){
				item.setTextColorUnSelected();
				item.isSelected = false;
			}
		}
				
		public function get items() : Array {
			return _items;
		}
		
		public function set items(items : Array) : void {
			_items = items;
		}				
	}
}
